package cn.wgspring.wedding_helper.model

import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
import kotlinx.serialization.Serializable
import kotlinx.serialization.Transient

// 购物清单项
@Serializable
class ShoppingItem(
    val id: Int = -1,           // 物品唯一ID，用于持久化与排序
    val name: String,           // 物品名称
    val category: String,       // 物品类别
    val timePhase: String,      // 时间阶段
    val quantity: String,       // 数量
    val note: String = "",      // 备注
    val purchased: Boolean = false,  // 是否已购买
) {
    @Transient
    private val purchasedState = mutableStateOf(purchased)
    
    @Transient
    var isPurchased: Boolean
        get() = purchasedState.value
        set(value) {
            purchasedState.value = value
        }
}